<template>
<div class="administer">
        <div class="administerNav">
            <backHeader></backHeader>
        </div>
        <div class="administerCont" v-show="!showDetail && !showHistory">
            <div class="html_pst">
                <el-form :inline="true" class="demo-form-inline series">
                    <div class="information_top">
                            <el-form-item label="设计单位" class="witd">
                                <el-select v-model="request.designer">
                                    <el-option label="全部" value=""></el-option>
                                    <el-option v-for="item in sjdwList" :label="item" :value="item"></el-option>
                                </el-select>
                            </el-form-item>
                            <el-form-item label="灯参编号" class="witd">
                                <el-input v-model="request.lampparamNoLike "></el-input>
                            </el-form-item>
                            <el-form-item label="功率" class="power">
                                <el-input v-model="request.lampPowerMin"></el-input>
                                <span class="xian">-</span>
                                <el-input v-model="request.lampPowerMax"></el-input>
                                <span>W</span>
                            </el-form-item>
                    <!-- </div>
                    <div class="information_bottom"> -->
                        <el-form-item label="应用面类型" class="witd">
                            <el-select v-model="request.contestType">
                                    <el-option label="全部" value=""></el-option>
                                    <el-option v-for="item in typeList" :label="item.dictCont" :value="item.id" :key="item.id"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="征灯阶段" class="witd  witd1">
                            <el-select v-model="request.contrastType">
                                <el-option label="全部" value=""></el-option>
                                <el-option label="定标" value="1"></el-option>
                                <el-option label="定样" value="2"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="推送日期" class="witd2">
                        <el-date-picker
                            v-model="time"
                            type="daterange"
                            range-separator="-"
                            format="yyyy-MM-dd" value-format="yyyy-MM-dd"
                            start-placeholder="开始日期"
                            end-placeholder="结束日期">
                            </el-date-picker>
                        </el-form-item>
                        <el-form-item>
                            <el-button type="primary" @click="search(1)">查询</el-button>
                        </el-form-item>
                    </div>
                </el-form>
                <div class="roleControl">
                        <el-table
                            :data="tableData"
                            border
                            style="width: 100%"
                            :max-height="tableHeight"
                            >
                            <el-table-column type="index" label="序号" width="50"> </el-table-column>
                            <el-table-column prop="lampparamNo" label="灯参编号">
                                <template slot-scope="scope">
                                    <div class="bianhao" @click.stop="showLampParamDetail(scope.row.lampparamId)">
                                        {{scope.row.lampparamNo }}
                                    </div>
                                </template>    
                            </el-table-column>  
                            <el-table-column prop="projectLampparamHisVo.contestTypeString" label="应用面类型"></el-table-column>
                            <el-table-column prop="designer" label="设计单位"></el-table-column>
                            <el-table-column prop="linkMan" label="联系人"></el-table-column>
                            <el-table-column prop="linkPhone" label="联系方式"></el-table-column>
                            <el-table-column prop="lampType" label="灯具类型"></el-table-column>
                            <el-table-column prop="projectLampparamHisVo.lampPower" label=" 功率(W)"></el-table-column>
                            <el-table-column prop="projectLampparamHisVo.versionStr" label=" 灯参版本"></el-table-column>
                            <el-table-column prop="projectLampparamHisVo.controlProtocol" label="控制协议"></el-table-column>
                            <el-table-column prop="effect" label=" 征灯阶段">
                                <template slot-scope="scope">
                                    <span>{{scope.row.contrastType == 1? '定标' : '定样'}}</span>
                                </template>
                            </el-table-column>
                            <el-table-column prop="startDate" label="开始时间">
                                <template slot-scope="scope">{{getDate(scope.row.startDate)}}</template> 
                            </el-table-column>
                            <el-table-column prop="endDate" label=" 结束时间">
                                <template slot-scope="scope">{{getDate(scope.row.endDate)}}</template>
                            </el-table-column>
                            <el-table-column prop="createDate" label="推送日期">
                                <template slot-scope="scope">{{getDate(scope.row.createDate)}}</template> 
                            </el-table-column>
                            <el-table-column label=" 操作">
                                <template slot-scope="scope">
                                    <el-button @click="handleClick(scope.row)" type="text" size="small">历史版本</el-button>
                                    <el-button @click="getDetailList(scope.row)" type="text" class="mefn" size="small">数据详情</el-button>
                                </template>
                            </el-table-column>
                        </el-table>
                </div>
            </div>
        </div>
                <!--历史记录 -->
                <div class="administerCont" v-show="showHistory">
                    <div class="html_pst">
                        <div class="roleControl">
                            <el-button @click="showHistory = false">返回灯参列表</el-button>
                            <el-table
                                :data="historyTable"
                                border
                                style="width: 100%"
                                :max-height="tableHeight"
                                >
                                <el-table-column type="index" label="序号" width="50"> </el-table-column>
                                <el-table-column prop="lampparamNo" label="灯参编号">
                                    <template slot-scope="scope">
                                        <div class="bianhao" @click.stop="showLampParamDetail(scope.row.lampparamId)">
                                            {{scope.row.lampparamNo }}
                                        </div>
                                    </template>    
                                </el-table-column>
                                <el-table-column prop="contestTypeString" label="应用面类型"></el-table-column>
                                <el-table-column prop="lampType" label="灯具类型"></el-table-column>
                                <el-table-column prop="lampPower" label="功率(W)"></el-table-column>
                                <el-table-column prop="controlProtocol" label="控制协议"></el-table-column>
                                <el-table-column prop="versionStr" label=" 版本号"></el-table-column>
                            </el-table>
                        </div>
                    </div>
                </div>
                <!--数据详情 -->
                <div class="administerCont" v-show="showDetail" >
                    <div class="html_pst">
                        <div class="roleControl">
                            <el-button @click="showDetail = false">返回灯参列表</el-button>
                            <el-table
                                @row-click="clickRow"
                                :row-class-name="tableRowClassName"
                                :data="detailTable"
                                border
                                style="width: 100%"
                                :max-height="tableHeight"
                                >
                                <el-table-column type="index" label="序号" width="50"> </el-table-column>
                                <el-table-column prop="num" label="效果图">
                                    <template slot-scope="scope" >
                                        <img :src="ImgPath+scope.row.viewPhoto" height="80" alt="" @click="viewPicture(ImgPath+scope.row.viewPhoto)">
                                    </template>    
                                </el-table-column>  
                                <el-table-column prop="num" label="伪色图">
                                    <template slot-scope="scope" >
                                        <img :src="ImgPath+scope.row.pseuColor" height="80" alt="" @click="viewPicture(ImgPath+scope.row.pseuColor)">
                                    </template>
                                </el-table-column>  
                                <el-table-column prop="brandName" label="品牌"></el-table-column>
                                <el-table-column prop="posCode" label="编号"></el-table-column>
                                <el-table-column prop="lumModel" label="样品型号"></el-table-column>
                                <el-table-column prop="colorTempe" label="色温(K)"></el-table-column>
                                <el-table-column prop="lumPower" label="功率(W)"></el-table-column>
                               
                               
                                <template v-if="LeftRowLampparamInfo.projectLampparamVo.contestTypeString=='控光点光源'" >
                                    <el-table-column prop="lightIntensity1" label="0°(cd)" :key="Math.random()">
                                        <template slot-scope="scope">
                                            <span v-show="scope.row.lightIntensity1 != null && scope.row.lightIntensity1 != ''">
                                                <span v-if="scope.$index==0 || (scope.$index == 1 && LeftRowLampparamInfo.projectParamindexList.length>1)">≥{{scope.row.lightIntensity1}}</span>
                                                <span v-else>{{scope.row.lightIntensity1}}</span>
                                            </span>
                                        </template>
                                        
                                    </el-table-column>
                                    <el-table-column prop="lightIntensity6" label="上30°(cd)" :key="Math.random()"></el-table-column>
                                    <el-table-column prop="lightIntensity4" label="下60°(cd)" :key="Math.random()">
                                        <template slot-scope="scope">
                                            <span v-show="scope.row.lightIntensity4 != null && scope.row.lightIntensity4 != ''">
                                                <span v-if="scope.$index==0 || (scope.$index == 1 && LeftRowLampparamInfo.projectParamindexList.length>1)">≥{{scope.row.lightIntensity4}}</span>
                                                <span v-else>{{scope.row.lightIntensity4}}</span>
                                            </span>
                                        </template>
                                    </el-table-column>
                                    <el-table-column prop="lightIntensity5" label="左60°(cd)" :key="Math.random()">
                                        <template slot-scope="scope">
                                            <span v-show="scope.row.lightIntensity5 != null && scope.row.lightIntensity5 != ''">
                                                <span v-if="scope.$index==0 || (scope.$index == 1 && LeftRowLampparamInfo.projectParamindexList.length>1)">≥{{scope.row.lightIntensity5}}</span>
                                                <span v-else>{{scope.row.lightIntensity5}}</span>
                                            </span>
                                        </template>
                                    </el-table-column>
                                    <el-table-column prop="lightIntensity2" label="右60°(cd)" :key="Math.random()">
                                        <template slot-scope="scope">
                                            <span v-show="scope.row.lightIntensity2 != null && scope.row.lightIntensity2 != ''">
                                                <span v-if="scope.$index==0 || (scope.$index == 1 && LeftRowLampparamInfo.projectParamindexList.length>1)">≥{{scope.row.lightIntensity2}}</span>
                                                <span v-else>{{scope.row.lightIntensity2}}</span>
                                            </span>
                                        </template>
                                    </el-table-column>
                                </template>
                                <template v-else-if="LeftRowLampparamInfo.projectLampparamVo.contestTypeString=='不控光点光源'">
                                    <el-table-column prop="lightIntensity1" label="0°(cd)" :key="Math.random()">
                                        <template slot-scope="scope">
                                             <span v-show="scope.row.lightIntensity1 != null && scope.row.lightIntensity1 != ''">
                                                <span v-if="scope.$index==0 || (scope.$index == 1 && LeftRowLampparamInfo.projectParamindexList.length>1)">≥{{scope.row.lightIntensity1}}</span>
                                                <span v-else>{{scope.row.lightIntensity1}}</span>
                                            </span>
                                        </template>
                                    </el-table-column>
                                    <el-table-column prop="lightIntensity8" label="上60°(cd)" :key="Math.random()">
                                        <template slot-scope="scope">
                                            <span v-show="scope.row.lightIntensity8 != null && scope.row.lightIntensity8 != ''">
                                                <span v-if="scope.$index==0 || (scope.$index == 1 && LeftRowLampparamInfo.projectParamindexList.length>1)">≥{{scope.row.lightIntensity8}}</span>
                                                <span v-else>{{scope.row.lightIntensity8}}</span>
                                            </span>
                                        </template>
                                    </el-table-column>
                                    <el-table-column prop="lightIntensity4" label="下60°(cd)" :key="Math.random()">
                                        <template slot-scope="scope">
                                            <span v-show="scope.row.lightIntensity4 != null && scope.row.lightIntensity4 != ''">
                                                <span v-if="scope.$index==0 || (scope.$index == 1 && LeftRowLampparamInfo.projectParamindexList.length>1)">≥{{scope.row.lightIntensity4}}</span>
                                                <span v-else>{{scope.row.lightIntensity4}}</span>
                                            </span>
                                        </template>
                                    </el-table-column>
                                    <el-table-column prop="lightIntensity5" label="左60°(cd)" :key="Math.random()">
                                        <template slot-scope="scope">
                                            <span v-show="scope.row.lightIntensity5 != null && scope.row.lightIntensity5 != ''">
                                                <span v-if="scope.$index==0 || (scope.$index == 1 && LeftRowLampparamInfo.projectParamindexList.length>1)">≥{{scope.row.lightIntensity5}}</span>
                                                <span v-else>{{scope.row.lightIntensity5}}</span>
                                            </span>
                                        </template>
                                    </el-table-column>
                                    <el-table-column prop="lightIntensity2" label="右60°(cd)" :key="Math.random()">
                                        <template slot-scope="scope">
                                            <span v-show="scope.row.lightIntensity2 != null && scope.row.lightIntensity2 != ''">
                                                <span v-if="scope.$index==0 || (scope.$index == 1 && LeftRowLampparamInfo.projectParamindexList.length>1)">≥{{scope.row.lightIntensity2}}</span>
                                                <span v-else>{{scope.row.lightIntensity2}}</span>
                                            </span>
                                        </template>
                                    </el-table-column>
                                </template>
                                <template v-else-if="LeftRowLampparamInfo.projectLampparamVo.contestTypeString=='远视点光源'">
                                    <el-table-column prop="lightIntensity6" label="上30°(cd)"></el-table-column>
                                    <el-table-column prop="lightIntensity3 " label="下45°(cd)"></el-table-column>
                                    
                                    <el-table-column prop="lightIntensity7" label="下10°(cd)">
                                        <template slot-scope="scope">
                                            <span v-show="scope.row.lightIntensity7 != null && scope.row.lightIntensity7 != ''">
                                                <span v-if="scope.$index==0 || (scope.$index==1 && LeftRowLampparamInfo.projectParamindexList.length>1)">≥{{scope.row.lightIntensity7}}</span>
                                                <span v-else>{{scope.row.lightIntensity7}}</span>
                                            </span>
                                        </template>
                                    </el-table-column>
                                    <el-table-column prop="lightIntensity9" label="下10°左60°(cd)">
                                        <template slot-scope="scope">
                                            <span v-show="scope.row.lightIntensity9 != null && scope.row.lightIntensity9 != ''">
                                                <span v-if="scope.$index==0 || (scope.$index==1 && LeftRowLampparamInfo.projectParamindexList.length>1)">≥{{scope.row.lightIntensity9}}</span>
                                                <span v-else>{{scope.row.lightIntensity9}}</span>
                                            </span>
                                        </template>
                                    </el-table-column>
                                    <el-table-column prop="lightIntensity10" label="下10°右60°(cd)">
                                        <template slot-scope="scope">
                                            <span v-show="scope.row.lightIntensity10 != null && scope.row.lightIntensity10 != ''">
                                                <span v-if="scope.$index==0 || (scope.$index==1 && LeftRowLampparamInfo.projectParamindexList.length>1)">≥{{scope.row.lightIntensity10}}</span>
                                                <span v-else>{{scope.row.lightIntensity10}}</span>
                                            </span>
                                        </template>
                                    </el-table-column>
                                </template>
                                <template v-else-if="LeftRowLampparamInfo.projectLampparamVo.contestTypeString=='正投'">
                                    <el-table-column prop="lumSize" label="D(m)" width="120" :key="Math.random()"></el-table-column>
                                    <el-table-column prop="lightnessAve" label="平均亮度（cd/㎡）" width="150" :key="Math.random()">
                                    </el-table-column>
                                    
                                    <el-table-column prop="lightnessMax" v-if="LeftRowLampparamInfo.projectLampparamVo.brightnessMax == 'brightnessMax'" label="最大亮度（cd /㎡）" width="150" :key="Math.random()">
                                        <template slot-scope="scope">
                                            <span v-show="scope.row.lightnessMax != null && scope.row.lightnessMax != ''">
                                                <span v-if="scope.$index==0 || (scope.$index==1 && LeftRowLampparamInfo.projectParamindexList.length>1)">≤{{scope.row.lightnessMax}}</span>
                                                <span v-else>{{scope.row.lightnessMax}}</span>
                                            </span>
                                        </template>
                                    </el-table-column>

                                    <el-table-column prop="brightnessA"  v-else label="A点亮度（cd /㎡）" width="150" :key="Math.random()">
                                        <template slot-scope="scope">
                                            <span v-show="scope.row.brightnessA != null && scope.row.brightnessA != ''">
                                                <span v-if="scope.$index==0 || (scope.$index==1 && LeftRowLampparamInfo.projectParamindexList.length>1)">≥{{scope.row.brightnessA}}</span>
                                                <span v-else>{{scope.row.brightnessA}}</span>
                                            </span>
                                        </template>
                                    </el-table-column>

                                    <el-table-column prop="evenness" label="均匀度" :key="Math.random()">
                                        <template slot-scope="scope">
                                            <span v-show="scope.row.evenness != null && scope.row.evenness != ''">
                                                <span v-if="scope.$index==0 || (scope.$index == 1 && LeftRowLampparamInfo.projectParamindexList.length>1)">≥{{scope.row.evenness}}</span>
                                                <span v-else>{{scope.row.evenness}}</span>
                                            </span>        
                                        </template>
                                    </el-table-column>
                                </template>
                                <template v-else-if="LeftRowLampparamInfo.projectLampparamVo.contestTypeString=='复合面' || LeftRowLampparamInfo.projectLampparamVo.contestTypeString=='窗框'">
                                    <el-table-column prop="surfaceType" label="测试面" :key="Math.random()"></el-table-column>
                                    <el-table-column prop="lumSize" label="D(m)" width="120" :key="Math.random()"></el-table-column>
                                    <el-table-column prop="testAngle" label="测试角度" width="120" :key="Math.random()"></el-table-column>
                                    <el-table-column prop="lightnessAve" label="平均亮度（cd/㎡）" width="150" :key="Math.random()">
                                    </el-table-column>
                                    
                                    <el-table-column prop="lightnessMax" label="最大亮度（cd /㎡）" width="150" :key="Math.random()">
                                        <template slot-scope="scope">
                                        <span v-show="scope.row.lightnessMax != null && scope.row.lightnessMax != ''">
                                            <span v-if="scope.$index==0 || (scope.$index == 1 && LeftRowLampparamInfo.projectParamindexList.length>1)">≤{{scope.row.lightnessMax}}</span>
                                            <span v-else>{{scope.row.lightnessMax}}</span>
                                        </span>
                                        </template>
                                    </el-table-column>
                                    <el-table-column prop="lightness" label="最小亮度（cd/㎡）" width="150" :key="Math.random()">
                                        <template slot-scope="scope">
                                            <span v-show="scope.row.lightness != null && scope.row.lightness != ''">
                                                <span v-if="scope.$index==0 || (scope.$index == 1 && LeftRowLampparamInfo.projectParamindexList.length>1)">≥{{scope.row.lightness}}</span>
                                                <span v-else>{{scope.row.lightness}}</span>
                                            </span>
                                        </template>
                                    </el-table-column>
                                    <el-table-column prop="evenness" label="均匀度" :key="Math.random()">
                                        <template slot-scope="scope">
                                            <span v-show="scope.row.evenness != null && scope.row.evenness != ''">≥{{scope.row.evenness}}</span>
                                        </template>
                                    </el-table-column>
                                </template>
                                <template v-else>
                                    <el-table-column prop="lumSize" label="D(m)" width="120" :key="Math.random()"></el-table-column>
                                    <el-table-column prop="testAngle" label="测试角度" width="120" :key="Math.random()"></el-table-column>
                                    <el-table-column prop="lightnessAve" label="平均亮度（cd/㎡）" width="150" :key="Math.random()">
                                    </el-table-column>
                                    <el-table-column prop="lightnessMax" label="最大亮度（cd /㎡）" width="150" :key="Math.random()">
                                        <template slot-scope="scope">
                                            <span v-show="scope.row.lightnessMax != null && scope.row.lightnessMax != ''">
                                                <span v-if="scope.$index==0 || (scope.$index == 1 && LeftRowLampparamInfo.projectParamindexList.length>1)">≤{{scope.row.lightnessMax}}</span>
                                                <span v-else>{{scope.row.lightnessMax}}</span>
                                            </span>
                                        </template>
                                    </el-table-column>
                                    <el-table-column prop="lightness" label="最小亮度（cd/㎡）" width="150" :key="Math.random()">
                                        <template slot-scope="scope">
                                            <span v-show="scope.row.lightness != null && scope.row.lightness != ''">
                                            <span v-if="scope.$index==0 || (scope.$index == 1 && LeftRowLampparamInfo.projectParamindexList.length>1)">≥{{scope.row.lightness}}</span>
                                            <span v-else>{{scope.row.lightness}}</span>
                                            </span>
                                        </template>
                                    </el-table-column>
                                    <el-table-column prop="evenness" label="均匀度" :key="Math.random()">
                                        <template slot-scope="scope">
                                            <span v-show="scope.row.evenness != null && scope.row.evenness != ''">
                                                <span v-if="scope.$index==0 || (scope.$index == 1 && LeftRowLampparamInfo.projectParamindexList.length>1)">≥{{scope.row.evenness}}</span>
                                                <span v-else>{{scope.row.evenness}}</span>
                                            </span>
                                        </template>
                                    </el-table-column>
                                </template>
                                

                                <el-table-column prop="judge" label="参与定样">
                                    <template slot-scope="scope">
                                        <div></div>
                                            <el-button v-if="scope.row.contrastDetection.sampleFlag == true" @click.stop="updateStatus(scope.row,2)" type="text" size="small">是</el-button>
                                            <el-button v-else-if="scope.row.contrastDetection.sampleFlag == false" @click.stop="updateStatus(scope.row,1)" type="text" size="small">否</el-button>
                                    </template>
                                </el-table-column>
                                <!-- <el-table-column label=" 操作">
                                    <template slot-scope="scope">
                                        <el-button @click="updateStatus(scope.row,1)" type="text" size="small">参与定样</el-button>
                                        <el-button @click="updateStatus(scope.row,2)" type="text" size="small">撤回</el-button>
                                    </template>
                                </el-table-column> -->
                            </el-table>
                        </div>
                     </div>
                </div>
       <!--查看图片 -->
    <el-dialog :visible.sync="showPic"  v-dialogDrag custom-class="dee">
      <img :src="showPicUrl" />
    </el-dialog>
        <parameterLampDetail ref="lampParamDetail"></parameterLampDetail>
        <selectLampDetail ref="detail"></selectLampDetail>
    </div>
</template>
<script>
import backHeader from '@/views/common/backHeader.vue'
import parameterLampDetail from '@/views/component/parameterLampDetail.vue'
import selectLampDetail from '@/views/component/selectLampDetail.vue'
export default {
    data() {
      return {
          showPicUrl:'',
          showPic:false,
          showDetail:false,
          showHistory:false,
          tableHeight :200,
          request:{
              lampparamNoLike:"",
              contestType:'',
              contrastType:'',
              page:1,
              rows:20
          },
          tableData:[],
          tableCount:0,
          detailTable:[],
          detailCount:0,
          historyTable:[],
          historyCount:0,
          collectBrandIds:'',
          typeList:[],
          sjdwList:[],
          time:[],
          currentLeftRow:{},
          LeftRowLampparamInfo:{
              projectLampparamVo:{},
              
          }
      }
    },
    components:{
        backHeader,
        parameterLampDetail,
        selectLampDetail
    },
    created(){
        this.initData()
        let self = this
        //设计单位
        this.$http.postObj('/api/contrast/designerJsonForSupplier',{},function(res){
            self.sjdwList = res.data
        })
        
        //加载应用类型
        this.$http.get("/api/dictTypeAllList", {indexPinyin:'yingyongchangjingleixing'}, function(res) {
                if (res.success) {
                    self.typeList = res.data;
                }
        });
    },
    methods: {
        clickRow(item){
            this.$refs.detail.show(item.id)
        },
        tableRowClassName({row, rowIndex}){
            let self = this
            var count = 0
                    var paramList = self.LeftRowLampparamInfo.projectParamindexList;
                    for(var i = 0;i<paramList.length;i++){
                        if(paramList[i].colorTemperatureStr == '全亮'){
                            count ++
                        }
                    }
            if(rowIndex == 0 && count > 0){
                return 'firstRow'
            }else if(rowIndex == 1 && count > 1){
                return 'firstRow'
            }else if(row.dataType == 1){
                return 'blurRow'
            }
        },
        viewPicture(url){
            this.showPic = true
            this.showPicUrl = url
        },
        //详情
        showLampParamDetail(id){
            this.$refs.lampParamDetail.show(id,false,'6',false)
        },
        getDate(date){
            if(date != null && date != ''){
                return date.split(' ')[0]
            }
            return ""
        },
        initData(){
            let self = this
            var ids = ''
            this.$http.postObj('/api/brands/pageJson',{page:1,rows:20,},function(res){
                if(res.success){
                    for(var i = 0;i<res.data.rows.length;i++){
                        ids += res.data.rows[i].id + ","
                    }
                    ids = ids.substr(0,ids.length-1)
                    self.collectBrandIds = ids
                    self.search(1)
                }
            })
        },
        //获取灯参信息列表
        search(page){
            if(this.time != null && this.time.length > 0){
                this.request.createDateStart = this.time[0]
                this.request.createDateEnd = this.time[1]
            }else{
                this.request.createDateStart=''
                this.request.createDateEnd=''
            }
            
            this.request.page = page
            let self = this
            this.$http.postObj('/api/contrast/relationJsonForSupplier',this.request,function(res){
                if(res.success){
                    self.tableData = res.data.rows
                    self.tableCount = res.data.total
                }
            })
        },
        //获取数据详情列表
        getDetailList(row){
            this.currentLeftRow = row
            let self = this
            this.$http.get('/api/lampparams/view/'+row.lampparamId,{},function(res){
                if(res.success){
                    self.LeftRowLampparamInfo = res.data
                    self.detailSearch()
                }
            })
        },
        detailSearch(){
            let self = this
            this.$http.postQueryObj('/api/contrast/lampParamCompDetectionJson/'+this.currentLeftRow.designCode,{dectType:'1,2'},{ brandIds:this.collectBrandIds},function(res){
                if(res.success){
                    let temp = []
                    if(res.data != null && res.data.detectionList != null && res.data.detectionList.rows != null){
                        temp = res.data.detectionList.rows
                    }
                    let lumSize = '';
                    if(self.LeftRowLampparamInfo.projectLampparamVo.lumSizeMin != null && self.LeftRowLampparamInfo.projectLampparamVo.lumSizeMin != '' &&self.LeftRowLampparamInfo.projectLampparamVo.lumSize != null && self.LeftRowLampparamInfo.projectLampparamVo.lumSize != ''){
                        lumSize = self.LeftRowLampparamInfo.projectLampparamVo.lumSizeMin + "~" +self.LeftRowLampparamInfo.projectLampparamVo.lumSize
                    }else if(self.LeftRowLampparamInfo.projectLampparamVo.lumSizeMin != null && self.LeftRowLampparamInfo.projectLampparamVo.lumSizeMin != ''){
                        lumSize = '' + self.LeftRowLampparamInfo.projectLampparamVo.lumSizeMin;
                    }else if(self.LeftRowLampparamInfo.projectLampparamVo.lumSize != null && self.LeftRowLampparamInfo.projectLampparamVo.lumSize != ''){
                        lumSize = '' + self.LeftRowLampparamInfo.projectLampparamVo.lumSize
                    }
                    let lightnessAve = '';
                    if(self.LeftRowLampparamInfo.projectParamindexList[0].brightnessAvgMin != null && self.LeftRowLampparamInfo.projectParamindexList[0].brightnessAvgMin != '' &&self.LeftRowLampparamInfo.projectParamindexList[0].brightnessAvgMax != null && self.LeftRowLampparamInfo.projectParamindexList[0].brightnessAvgMax != ''){
                        lightnessAve = self.LeftRowLampparamInfo.projectParamindexList[0].brightnessAvgMin + "~" +self.LeftRowLampparamInfo.projectParamindexList[0].brightnessAvgMax
                    }else if(self.LeftRowLampparamInfo.projectParamindexList[0].brightnessAvgMin != null && self.LeftRowLampparamInfo.projectParamindexList[0].brightnessAvgMin != ''){
                        lightnessAve = '' + self.LeftRowLampparamInfo.projectParamindexList[0].brightnessAvgMin;
                    }else if(self.LeftRowLampparamInfo.projectParamindexList[0].brightnessAvgMax != null && self.LeftRowLampparamInfo.projectParamindexList[0].brightnessAvgMax != ''){
                        lightnessAve = '' + self.LeftRowLampparamInfo.projectParamindexList[0].brightnessAvgMax
                    }
                    let lightIntensity6 = '';
                    if(self.LeftRowLampparamInfo.projectLampparamVo.verticalUp30 != null && self.LeftRowLampparamInfo.projectLampparamVo.verticalUp30 != '' &&self.LeftRowLampparamInfo.projectLampparamVo.verticalUp30Max != null && self.LeftRowLampparamInfo.projectLampparamVo.verticalUp30Max != ''){
                        lightIntensity6 = self.LeftRowLampparamInfo.projectLampparamVo.verticalUp30 + "~" +self.LeftRowLampparamInfo.projectLampparamVo.verticalUp30Max
                    }else if(self.LeftRowLampparamInfo.projectLampparamVo.verticalUp30 != null && self.LeftRowLampparamInfo.projectLampparamVo.verticalUp30 != ''){
                        lightIntensity6 = '' + self.LeftRowLampparamInfo.projectLampparamVo.verticalUp30;
                    }else if(self.LeftRowLampparamInfo.projectLampparamVo.verticalUp30Max != null && self.LeftRowLampparamInfo.projectLampparamVo.verticalUp30Max != ''){
                        lightIntensity6 = '' + self.LeftRowLampparamInfo.projectLampparamVo.verticalUp30Max
                    }
                    let lightIntensity3 = '';
                     if(self.LeftRowLampparamInfo.projectLampparamVo.down45 != null && self.LeftRowLampparamInfo.projectLampparamVo.down45 != '' &&self.LeftRowLampparamInfo.projectLampparamVo.down45Max != null && self.LeftRowLampparamInfo.projectLampparamVo.down45Max != ''){
                        lightIntensity3 = self.LeftRowLampparamInfo.projectLampparamVo.down45 + "~" +self.LeftRowLampparamInfo.projectLampparamVo.down45Max
                    }else if(self.LeftRowLampparamInfo.projectLampparamVo.down45 != null && self.LeftRowLampparamInfo.projectLampparamVo.down45 != ''){
                        lightIntensity3 = '' + self.LeftRowLampparamInfo.projectLampparamVo.down45;
                    }else if(self.LeftRowLampparamInfo.projectLampparamVo.down45Max != null && self.LeftRowLampparamInfo.projectLampparamVo.down45Max != ''){
                        lightIntensity3 = '' + self.LeftRowLampparamInfo.projectLampparamVo.down45Max
                    }
                    // let lumSize = '';
                    // if(self.LeftRowLampparamInfo.projectLampparamVo.lumSizeMin != null && self.LeftRowLampparamInfo.projectLampparamVo.lumSizeMin != '' &&self.LeftRowLampparamInfo.projectLampparamVo.lumSize != null && self.LeftRowLampparamInfo.projectLampparamVo.lumSize != ''){
                    //     lumSize = self.LeftRowLampparamInfo.projectLampparamVo.lumSizeMin + "~" +self.LeftRowLampparamInfo.projectLampparamVo.lumSize
                    // }else if(self.LeftRowLampparamInfo.projectLampparamVo.lumSizeMin != null && self.LeftRowLampparamInfo.projectLampparamVo.lumSizeMin != ''){
                    //     lumSize = '≥' + self.LeftRowLampparamInfo.projectLampparamVo.lumSizeMin;
                    // }else if(self.LeftRowLampparamInfo.projectLampparamVo.lumSize != null && self.LeftRowLampparamInfo.projectLampparamVo.lumSize != ''){
                    //     lumSize = '≤' + self.LeftRowLampparamInfo.projectLampparamVo.lumSize
                    // }
                    // let lightnessAve = '';
                    // if(self.LeftRowLampparamInfo.projectLampparamVo.brightnessAvgMin != null && self.LeftRowLampparamInfo.projectLampparamVo.brightnessAvgMin != '' &&self.LeftRowLampparamInfo.projectLampparamVo.brightnessAvgMax != null && self.LeftRowLampparamInfo.projectLampparamVo.brightnessAvgMax != ''){
                    //     lightnessAve = self.LeftRowLampparamInfo.projectLampparamVo.brightnessAvgMin + "~" +self.LeftRowLampparamInfo.projectLampparamVo.brightnessAvgMax
                    // }else if(self.LeftRowLampparamInfo.projectLampparamVo.brightnessAvgMin != null && self.LeftRowLampparamInfo.projectLampparamVo.brightnessAvgMin != ''){
                    //     lightnessAve = '≥' + self.LeftRowLampparamInfo.projectLampparamVo.brightnessAvgMin;
                    // }else if(self.LeftRowLampparamInfo.projectLampparamVo.brightnessAvgMax != null && self.LeftRowLampparamInfo.projectLampparamVo.brightnessAvgMax != ''){
                    //     lightnessAve = '≤' + self.LeftRowLampparamInfo.projectLampparamVo.brightnessAvgMax
                    // }
                    // let lightIntensity6 = '';
                    // if(self.LeftRowLampparamInfo.projectLampparamVo.verticalUp30 != null && self.LeftRowLampparamInfo.projectLampparamVo.verticalUp30 != '' &&self.LeftRowLampparamInfo.projectLampparamVo.verticalUp30Max != null && self.LeftRowLampparamInfo.projectLampparamVo.verticalUp30Max != ''){
                    //     lightIntensity6 = self.LeftRowLampparamInfo.projectLampparamVo.verticalUp30 + "~" +self.LeftRowLampparamInfo.projectLampparamVo.verticalUp30Max
                    // }else if(self.LeftRowLampparamInfo.projectLampparamVo.verticalUp30 != null && self.LeftRowLampparamInfo.projectLampparamVo.verticalUp30 != ''){
                    //     lightIntensity6 = '≥' + self.LeftRowLampparamInfo.projectLampparamVo.verticalUp30;
                    // }else if(self.LeftRowLampparamInfo.projectLampparamVo.verticalUp30Max != null && self.LeftRowLampparamInfo.projectLampparamVo.verticalUp30Max != ''){
                    //     lightIntensity6 = '≤' + self.LeftRowLampparamInfo.projectLampparamVo.verticalUp30Max
                    // }
                    // let lightIntensity3 = '';
                    //  if(self.LeftRowLampparamInfo.projectLampparamVo.down45 != null && self.LeftRowLampparamInfo.projectLampparamVo.down45 != '' &&self.LeftRowLampparamInfo.projectLampparamVo.down45Max != null && self.LeftRowLampparamInfo.projectLampparamVo.down45Max != ''){
                    //     lightIntensity3 = self.LeftRowLampparamInfo.projectLampparamVo.down45 + "~" +self.LeftRowLampparamInfo.projectLampparamVo.down45Max
                    // }else if(self.LeftRowLampparamInfo.projectLampparamVo.down45 != null && self.LeftRowLampparamInfo.projectLampparamVo.down45 != ''){
                    //     lightIntensity3 = '≥' + self.LeftRowLampparamInfo.projectLampparamVo.down45;
                    // }else if(self.LeftRowLampparamInfo.projectLampparamVo.down45Max != null && self.LeftRowLampparamInfo.projectLampparamVo.down45Max != ''){
                    //     lightIntensity3 = '≤' + self.LeftRowLampparamInfo.projectLampparamVo.down45Max
                    // }
                    var paramList = self.LeftRowLampparamInfo.projectParamindexList;
                    for(var i = 0;i<paramList.length;i++){
                        if(paramList[i].colorTemperatureStr == '全亮'){
                            temp.unshift({
                                posCode:self.LeftRowLampparamInfo.projectLampparamVo.lampparamNo,
                                colorTempe:self.LeftRowLampparamInfo.projectLampparamVo.colorTemperatureStr,
                                lumPower:self.LeftRowLampparamInfo.projectLampparamVo.lampPower,
                                voltage:self.LeftRowLampparamInfo.projectLampparamVo.workVoltage,
                                lumSize:lumSize,
                                surfaceType:self.LeftRowLampparamInfo.projectParamindexList[i].faceType,
                                lightnessAve:lightnessAve,
                                lightness:self.LeftRowLampparamInfo.projectParamindexList[i].brightnessMin,
                                lightnessMax:self.LeftRowLampparamInfo.projectParamindexList[i].brightnessMax,
                                brightnessA:self.LeftRowLampparamInfo.projectParamindexList[i].brightnessA,
                                evenness:self.LeftRowLampparamInfo.projectParamindexList[i].evenness,
                                lightIntensity1:self.LeftRowLampparamInfo.projectParamindexList[i].level0,
                                lightIntensity6:lightIntensity6,
                                lightIntensity8:self.LeftRowLampparamInfo.projectParamindexList[i].verticalUp60,
                                lightIntensity3:self.LeftRowLampparamInfo.projectParamindexList[i].down45  +"-"+self.LeftRowLampparamInfo.projectParamindexList[i].down45Max,
                                lightIntensity7:self.LeftRowLampparamInfo.projectParamindexList[i].verticalDown10,
                                lightIntensity4:self.LeftRowLampparamInfo.projectParamindexList[i].verticalDown60,
                                lightIntensity5:self.LeftRowLampparamInfo.projectParamindexList[i].levelLeft60,
                                lightIntensity2:self.LeftRowLampparamInfo.projectParamindexList[i].levelRight60,
                                lightIntensity9:self.LeftRowLampparamInfo.projectParamindexList[i].vertical10Left60,
                                lightIntensity10:self.LeftRowLampparamInfo.projectParamindexList[i].vertical10Right60,
                                contrastDetection:{
                                    sampleFlag:'view'
                                }
                            })
                        }
                    }
                    
                    self.detailTable = res.data.detectionList.rows;
                    if(res.data != null && res.data.detectionList != null && res.data.detectionList.total != null){
                        self.detailCount = res.data.detectionList.total
                    }
                    self.showDetail = true
                }
            })
        },
        //历史记录
        handleClick(row){
            let self = this
            this.$http.postQueryObj('/api/lampparams/hisJson/'+row.lampparamId,{versionStr:row.lampparamHisVersion},{page:1,rows:20},function(res){
                if(res.success){
                    self.historyTable = res.data.rows
                    self.historyCount = res.data.total
                    self.showHistory = true
                }
            })
        },
        //则取消参与定样1/则参与定样2
        updateStatus(row,flag){
            let self = this
            var text = '撤销'
            if(flag == 1){
                text = '参与定样'
            }
            this.$confirm('您确定要'+text+'吗?','提示',{
                confirmButtonText: '确认',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(()=>{
                console.log("1")
                this.$http.postQuery('/api/contrast/detection/'+row.contrastDetection.id,{operType:flag},function(res){
                    if(res.success){
                        self.detailSearch()
                        self.$message({
                            message: "操作成功！",
                            type: "success"
                        })
                    }else{
                        self.$message.error(res.data)
                    }
                })
            }).catch(()=>{});
        }
     },
     mounted(){
        this.$nextTick(function () {
            this.tableHeight = window.innerHeight - 280;
            
            // 监听窗口大小变化
            let self = this;
            window.onresize = function() {
                self.tableHeight = window.innerHeight - 280
            }
     })
  }
}
</script>
<style rel="stylesheet/scss" lang="scss">

.contrast{
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    background: rgba(0,0,0,0.5);
    z-index: -1;
    opacity: 0;
    display: none;
    &.active{
      opacity: 1;
      z-index: 999999;
      display: block;
    }
    .contrast_cont{
        display: inline-block;
        max-width: 1100px;
        max-height: 90vh;
        width: 100%;
        padding-bottom: 10px;
        vertical-align: middle;
        background-color: #fff;
        border-radius: 4px;
        border: 1px solid #ebeef5;
        font-size: 18px;
        box-shadow: 0 2px 12px 0 rgba(0,0,0,.1);
        text-align: left;
        overflow: hidden;
        backface-visibility: hidden;
        padding: 0;
        .lt_rt{
            display: box;
            display: -webkit-box;
            display: -moz-box;
            display: -o-box;
            position: relative;
            .rt_ct{
                width: 50%;
                padding: 10px 20px;
                position: relative;
                table{
                  width: 100%;
                  td{
                    font-size: 14px;
                    text-align: center;
                  }
                } 
                .el-icon-close{
                    float: right;
                   font-size: 20px;
                   cursor: pointer;
                   position: relative;
                }
                .p1{
                  font-size: 12px;
                  margin-bottom: 5px;
                }
                .cont{
                    position: relative;
                    margin-top: 18px;
                    display: block;
                     .set{
                         position: absolute;
                         text-align: right;
                         right: 0;
                         top: 70px;
                         color: #333333;
                     }
                    .xian{
                        color: #333333;
                        position: relative;
                        padding: 0px 0 6px;
                        border-bottom: 2px solid #eeeeee;
                        span{
                            position: absolute;
                            right: 0;
                            top: 0;
                            font-size: 14px;
                            cursor: pointer;
                        }
                        .xian_rt{
                            float: right;
                            font-size: 14px;
                             position: absolute;
                            right: 0;
                            top: 0;
                            span{
                                position: initial;
                                color: #208cc6;
                            }
                        }
                    }
                    ul{
                        margin: 5px 0 15px;
                        position: relative;
                        li{
                            width: 50%;
                            display: inline-block;
                            font-size: 12px;
                            margin-bottom: 2px;
                            color: #333333;
                            line-height: 1em;
                            margin-right: 0;
                            span:first-child{
                                color: #000;
                                font-weight: bold
                            }
                            span{
                              span{
                                color: #333333 !important;
                                font-weight: 500 !important
                              }
                            }
                        }
                    }
                }
                .bottm{
                    text-align: center;
                        margin-top: 20px;
                    button{
                        background-color: #eeeeee;
                        font-size: 12px;
                            padding: 7px 15px;
                    }

                }   
            }
            .lt_ct{
                width: 50%;
                background-color: #f8f8f8;
                padding: 20px;
                position: relative;
                .top{
                    margin-bottom: 15px;
                    background: none;
                    padding: 0;
                    span{
                        color: #666666;
                        margin-right: 12px;
                        &:nth-child(1),&:nth-child(3){
                            color: #208cc6;
                        }
                        &:last-child{
                            float: right;
                            font-size: 12px;
                            margin-right:0;
                            img{
                                position: relative;
                                top: 2px;
                                margin-right: 5px;
                                display: inline-block;
                            }
                        }
                    }
                }
                .cents{
                  position: relative;
                  .cents_s{
                    height: 44vh;
                  }
                    .cout_list{
                      height: 100%;
                      .gallery-top-box{
                          height: 100%;
                      }
                      .swiper-button-next, .swiper-button-prev{
                        background: rgba(0, 0, 0, 0.3) url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2027%2044'%3E%3Cpath%20d%3D'M27%2C22L27%2C22L5%2C44l-2.1-2.1L22.8%2C22L2.9%2C2.1L5%2C0L27%2C22L27%2C22z'%20fill%3D'%23ffffff'%2F%3E%3C%2Fsvg%3E");
                        top: auto !important;
                        margin-top: 0 !important;
                        bottom: 0;
                        height: 50px;
                        background-size: 12px !important;
                        background-position: center !important;
                        background-repeat: no-repeat !important;
                      }
                       .swiper-button-prev{
                           background: rgba(0, 0, 0, 0.3) url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2027%2044'%3E%3Cpath%20d%3D'M0%2C22L22%2C0l2.1%2C2.1L4.2%2C22l19.9%2C19.9L22%2C44L0%2C22L0%2C22L0%2C22z'%20fill%3D'%23ffffff'%2F%3E%3C%2Fsvg%3E");
                       }
                      .gallery-thumbs-box,.swiper-container,.swiper-wrapper{
                        height: 100%;
                      }
                      .swiper-slide{
                        height: 100%;
                      }
                        img{
                           max-height: 44vh;
                        }
                    }
                    .cent_ss{
                        overflow: auto;
                        margin-top: 16px;
                        padding: 0 38px;
                        li{
                            display: inline-block;
                            border-radius: 4px;
                            overflow: hidden;
                            margin-right: 10px;
                        }
                    }
                }
                .bom{
                    margin-top: 20px;
                    text-align: center;
                }
                 .bottm{
                    text-align: center;
                    margin-top: 20px;
                    a{
                        background-color: #5a63a3;
                            border-radius: 4px;
                        color: #fff;
                        font-size: 12px;
                            padding: 10px 22px;
                    }

                }           
            }
        }
    }
}
.el-button+.el-button.mefn{
    margin-left: 0;
}
.el-table .firstRow{
    background:#f8e7a0;
}
.el-table .blurRow{
    background:#c6ebf4;
}
.information_top{
    .witd{
        .el-form-item__content{
            width: 132px;
        }
        &.witd1 .el-form-item__content{
            width: 80px;
        }
    }
    .witd2{
        .el-form-item__content{
            .el-date-editor--daterange.el-input__inner{
                width: 260px;
            }
        }
    }
}
.series{
    margin-bottom: 10px;
    .el-form-item{
        margin-right: 10px;
    }
    .witd{
        .el-form-item__label{
            width: 82px;
        }
    }
    .power{
        .el-input{
            width: 58px;
        }
    }
    .el-button--primary{
        background-color: #5b65a1;
        border-radius: 4px;
        border: none;
    }
}
</style>
